package com.orhon.smartcampus.modules.baseinfo.mm;


import com.orhon.smartcampus.modules.base.mm.LangMapper;
import com.orhon.smartcampus.modules.baseinfo.entity.Semester;
import com.orhon.smartcampus.modules.baseinfo.gqlModel.GQLSemester;

import java.util.List;

import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

@Mapper(uses = {
        LangMapper.class
})
public interface SemesterMapper {

    SemesterMapper MAPPER = Mappers.getMapper(SemesterMapper.class);

    @Mapping(source = "id" , target = "id")
    @Mapping(source = "semesterCode" , target = "semester_code")
    @Mapping(source = "semesterName" , target = "name")
    @Mapping(source = "yearlyCode" , target = "yearly_code")
    @Mapping(source = "isCurrent" , target = "is_current")
    @Mapping(target = "school" , ignore = true)
    @Mapping(source = "startAt", target = "start_date")
    @Mapping(source = "endAt", target = "end_date")
    @Mapping(source = "weekTotal", target = "week_total")
    @Mapping(source = "teachingStartAt", target = "teaching_start_date")
    @Mapping(source = "teachingEndAt", target = "teaching_end_date")
    @Mapping(source = "semesterNumber", target = "semester_number")
    @Mapping(source = "semesterStatus", target = "semester_status")
    @Mapping(source = "firstWeekMonday", target = "first_week_monday")
    @Mapping(source = "firstWeekSunday", target = "first_week_sunday")
    GQLSemester toSemester(Semester entity);
    
    @InheritConfiguration(name = "toSemester")
    List<GQLSemester> toSemesterList(List<Semester> entities);

}
